﻿using System;

namespace eCommerce.DataAccess
{
    public class TransactionDA
    {
        public static void SaveTransactionDetails(Guid userId, string acsUrl, string addressResult, string avscv2, string cv2Result, string fullStatus, string md, string paReq, string postCodeResult, string securityKey, string status, string statusDetails, string threeDSecureStatus, string txAuthNo, string vendorTxCode, string vpsTxId)
        {
            eCommerceDataContext dataContext = new eCommerceDataContext();

            Transaction transaction = new Transaction
                                          {
                                              ACSUrl = acsUrl,
                                              AddressResult = addressResult,
                                              AVSCV2 = avscv2,
                                              CV2Result = cv2Result,
                                              FullStatus = fullStatus,
                                              MD = md,
                                              PAReq = paReq,
                                              PostCodeResult = postCodeResult,
                                              SecurityKey = securityKey,
                                              Status = status,
                                              StatusDetails = statusDetails,
                                              ThreeDSecureStatus = threeDSecureStatus,
                                              TxAuthNo = txAuthNo,
                                              userID = userId,
                                              VendorTxCode = vendorTxCode,
                                              VPSTxId = vpsTxId
                                          };
            dataContext.Transactions.InsertOnSubmit(transaction);
            dataContext.SubmitChanges();
        }
    }
}
